xend: Enable to set config variables in /etc/sysconfig/xend
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 7 Sep 2009 08:00:21 +0000 (09:00 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 7 Sep 2009 08:00:21 +0000 (09:00 +0100)
The attached patch enables to set the environment variables for xend
in /etc/sysconfig/xend.

There are four variables.

XENCONSOLED_TRACE=3D[none|guest|hv|all]
XENSTORED_ROOTDIR=3D/var/lib/xenstored
XENSTORED_TRACE=3D[yes|on|1]
XENBACKENDD_DEBUG=3D[yes|on|1]

The XENCONSOLED_TRACE and XENSTORED_ROOTDIR take strings for each
command's options. And if thease variables have non-zero strings, then
export them.
If the XENSTORED_TRACE and XENBACKENDD_DEBUG take either "yes", "on"
or "1" then export them.

From: Kazuhiro SUZUKI <kaz@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/hotplug/Linux/Makefile
tools/hotplug/Linux/init.d/sysconfig.xend [new file with mode: 0644]
tools/hotplug/Linux/init.d/xend

index 36f3ee0242747e21b4a93c3671bc8d89dfadbeb8..33ebdc6487e6ce2013c4363a178f33be6b35aec6 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 # Init scripts.
 XEND_INITD = init.d/xend
+XEND_SYSCONFIG = init.d/sysconfig.xend
 XENDOMAINS_INITD = init.d/xendomains
 XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains
 
@@ -62,6 +63,7 @@ install-initd:
        [ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/init.d
        [ -d $(DESTDIR)$(CONFIG_DIR)/sysconfig ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/sysconfig
        $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+       $(INSTALL_PROG) $(XEND_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xend
        $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
        $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xendomains
 
diff --git a/tools/hotplug/Linux/init.d/sysconfig.xend b/tools/hotplug/Linux/init.d/sysconfig.xend
new file mode 100644 (file)
index 0000000..18451c8
--- /dev/null
@@ -0,0 +1,11 @@
+# Log xenconsoled messages (cf xm dmesg)
+#XENCONSOLED_TRACE=[none|guest|hv|all]
+
+# Log xenstored messages
+#XENSTORED_TRACE=[yes|on|1]
+
+# Running xenstored on XENSTORED_ROOTDIR
+#XENSTORED_ROOTDIR=/var/lib/xenstored
+
+# Running xenbackendd in debug mode
+#XENBACKENDD_DEBUG=[yes|on|1]
index b98924a4591be85ec9d68ddf0aa9ce3da7327f3e..3230f864db8307cdcd34a83168bbb877ed702f43 100755 (executable)
@@ -19,6 +19,9 @@
 # Description:       Starts and stops the Xen control daemon.
 ### END INIT INFO
 
+shopt -s extglob
+test -f /etc/sysconfig/xend && . /etc/sysconfig/xend
+
 if ! grep -q "control_d" /proc/xen/capabilities ; then
        exit 0
 fi
@@ -41,6 +44,10 @@ case "$1" in
   start)
        mkdir -p /var/lock/subsys
        touch /var/lock/subsys/xend
+       test -z "$XENSTORED_ROOTDIR" || export XENSTORED_ROOTDIR
+       test -z "$XENCONSOLED_TRACE" || export XENCONSOLED_TRACE
+       [[ "$XENSTORED_TRACE" == @(yes|on|1) ]] && export XENSTORED_TRACE
+       [[ "$XENBACKENDD_DEBUG" == @(yes|on|1) ]] && export XENBACKENDD_DEBUG
        xend start
        await_daemons_up
        ;;